/**  \file ButtonMain.qml
\brief The main bottom buttons

Price My House for Nokia mobile platforms.

\author © 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
\author "Evimin Fiyati Price My House" is protected by the copyright law
\author Distributed under the LGPL 3.0 license.
\date 2011

\par Licensing notes

    "Price My House" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "Price My House" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "Price My House".
    If not, see <http://www.gnu.org/licenses/>.

*/

import QtQuick 1.0

BorderImage {
    id: mainbuttons
    width: parent.width
    height: parent.height

    property alias operation: buttonText.text
    property string side: ""
    signal clicked
    source: "images/BaseButton" + side + ".png"; clip: true
    border { left: 10; top: 10; right: 10; bottom: 10 }

    // Shade is set over the button image when it is presed
    Rectangle {
        id: shade;
        width: parent.width; height: parent.height;
        anchors.fill: mainbuttons; radius: 5; color: "black"; opacity: 0
    }

    Text {
        id: buttonText
        anchors.centerIn: parent;
        font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5
        style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
    }

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: { mainbuttons.clicked() }
    }

    // When button is pressed the shade changes
    states: State {
        name: "pressed"; when: mouseArea.pressed == true
        PropertyChanges { target: shade; opacity: .2 }
    }
}
